#include "tgmath.h"

namespace TG
{
	class Plane
	{
	public:
		vec3 normal;
		float D;

		Plane() :normal(vec3(0, 0, 0)), D(0) {}

		Plane(vec3 normal, float D) : normal(normal), D(D)
		{
		}

		Plane(float A, float B, float C, float D)
		{
			normal = vec3(A, B, C).normalize();
			this->D = D;
		}

		inline float distance(const vec3 &pos) const
		{
			return dot(normal, pos) + D;
		}
	};
}